package me.keiwu.user.dao;

import me.keiwu.user.domain.UserGroup;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by kei on 26/03/2018.
 */
public interface UserGroupDao extends BaseDao<UserGroup, Long> {


    @Query(value = "select * from user_group where user_id=?1 and open_gid=?2 and is_del=0 limit 1", nativeQuery = true)
    UserGroup findByUserIdAndOpenGid(Long userId, String openGid);

    @Query(value = "select * from user_group where user_id=?1 and is_del=0", nativeQuery = true)
    List<UserGroup> findByUserId(Long userId);

}
